package SI::Insurance::NewInsurReason;

use base qw/MyDB::Object/;

__PACKAGE__->meta->setup(
    table => 'InsurReason',
    columns =>
    [
        code => { type => 'varchar', length => 2, not_null => 1 },
        value => { type => 'varchar', length => 60, not_null => 1 },
    ],
    allow_inline_column_values => 1,
    primary_key_columns => [ 'code' ],
);

sub init_tab {
	  my $self = shift;
    my $stmt = 'CREATE TABLE IF NOT EXISTS InsurReason (
                          code VARCHAR(3) PRIMARY KEY NOT NULL,  -- 参保原因码
                          value VARCHAR(60) NOT NULL             -- 参保原因值
                          );';
	  my $db = $self->init_db;
    my $dbh = $db->dbh or die $db->error;
    $db->do_transaction(sub {$dbh->do($stmt)})
        or die $db->error;
    return 1;
}





1;
